import { DataTypes } from 'sequelize'

import Seq from '../config/sequelize.ts'

const Wallpaper = Seq.define(
  'wallpaper',
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      allowNull: false,
      unique: true,
      autoIncrement: true,
    },
    imgname: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: true,
      comment: '图片名称',
    },
    size: {
      type: DataTypes.DECIMAL(8, 2),
      allowNull: false,
      comment: '图片储存大小(k)',
    },
    remark: {
      type: DataTypes.STRING,
      comment: '备注',
    },
  },
  {
    // 防止表名变成复数
    freezeTableName: true,
  },
)

// Wallpaper.sync({ force: true })

export default Wallpaper
